package org.mcflier.appuntamento.io.driver.db;

import java.util.List;
import java.util.Properties;

import org.mcflier.appuntamento.core.exception.PropertiesException;
import org.mcflier.appuntamento.core.properties.PropertiesManager;
import org.mcflier.appuntamento.data.model.Genre;
import org.mcflier.appuntamento.data.model.Movie;
import org.mcflier.appuntamento.data.model.Production;
import org.mcflier.appuntamento.i18n.Country;
import org.mcflier.appuntamento.i18n.Language;
import org.mcflier.appuntamento.io.driver.db.interfaces.IJDBCDriver;
import org.mcflier.appuntamento.io.exception.JDBCConnectionException;
import org.mcflier.appuntamento.io.exception.JDBCStatementException;
import org.mcflier.appuntamento.io.exception.JDBCTransactionException;

public abstract class AbstractJDBCDriver implements IJDBCDriver {
	
	private Properties properties;
	
	public AbstractJDBCDriver() throws PropertiesException{
		PropertiesManager propertiesManager = PropertiesManager.getInstance();
		this.properties = propertiesManager.getProperties();
	}
	
	protected Properties getProperties(){
		return this.properties;
	}

	@Override
	public abstract boolean addMovie(Movie movie, boolean useTransaction) throws JDBCConnectionException, JDBCStatementException, JDBCTransactionException;

	@Override
	public abstract int addMovies(List<Movie> movies);

	@Override
	public abstract boolean existsMovie(String id) throws JDBCConnectionException, JDBCStatementException;

	@Override
	public abstract List<String> existMovies(List<String> ids) throws JDBCConnectionException, JDBCStatementException;

	@Override
	public abstract Movie getMovie(String id, String codeLanguage) throws JDBCConnectionException, JDBCStatementException;

	@Override
	public abstract List<Movie> getMovies(List<String> ids, String codeLanguage) throws JDBCConnectionException, JDBCStatementException;

	@Override
	public abstract boolean deleteMovie(String id, boolean useTransaction) throws JDBCTransactionException, JDBCStatementException, JDBCConnectionException;

	@Override
	public abstract boolean traceMovie(String id, boolean useTransaction);

	@Override
	public abstract boolean addGenre(Genre genre, boolean useTransaction) throws JDBCTransactionException, JDBCStatementException, JDBCConnectionException;

	@Override
	public abstract int addGenres(List<Genre> genres) throws JDBCTransactionException, JDBCStatementException, JDBCConnectionException;

	@Override
	public abstract boolean existsGenre(int id) throws JDBCStatementException, JDBCConnectionException;

	@Override
	public abstract List<Integer> existGenres(List<Integer> ids) throws JDBCStatementException, JDBCConnectionException;

	@Override
	public abstract Genre getGenre(int id) throws JDBCStatementException, JDBCConnectionException;

	@Override
	public abstract List<Genre> getMovieGenres(String idMovie) throws JDBCConnectionException, JDBCStatementException;

	@Override
	public abstract boolean deleteGenre(int id, boolean useTransaction) throws JDBCTransactionException, JDBCStatementException, JDBCConnectionException;

	@Override
	public abstract boolean addProduction(Production production, boolean useTransaction) throws JDBCStatementException, JDBCTransactionException, JDBCConnectionException;

	@Override
	public abstract int addProductions(List<Production> productions) throws JDBCTransactionException, JDBCStatementException, JDBCConnectionException;

	@Override
	public abstract boolean existsProduction(int id) throws JDBCStatementException, JDBCConnectionException;

	@Override
	public abstract List<Integer> existProductions(List<Integer> ids) throws JDBCStatementException, JDBCConnectionException;

	@Override
	public abstract Production getProduction(int id) throws JDBCStatementException, JDBCConnectionException;

	@Override
	public abstract List<Production> getMovieProductions(String idMovie) throws JDBCConnectionException, JDBCStatementException;

	@Override
	public abstract boolean deleteProduction(int id, boolean useTransaction) throws JDBCTransactionException, JDBCConnectionException, JDBCStatementException;

	@Override
	public abstract boolean addCountry(Country country, boolean useTransaction) throws JDBCTransactionException, JDBCStatementException, JDBCConnectionException;

	@Override
	public abstract int addCountries(List<Country> countries) throws JDBCTransactionException, JDBCStatementException, JDBCConnectionException;

	@Override
	public abstract boolean existsCountry(String code) throws JDBCStatementException, JDBCConnectionException;

	@Override
	public abstract List<String> existCountries(List<String> codes) throws JDBCStatementException, JDBCConnectionException;

	@Override
	public abstract Country getCountry(String code) throws JDBCStatementException, JDBCConnectionException;

	@Override
	public abstract List<Country> getMovieCountriesProduction(String idMovie) throws JDBCStatementException, JDBCConnectionException;

	@Override
	public abstract boolean deleteCountry(String code, boolean useTransaction) throws JDBCTransactionException, JDBCStatementException, JDBCConnectionException;

	@Override
	public abstract boolean addLanguage(Language language, boolean useTransaction) throws JDBCTransactionException, JDBCStatementException, JDBCConnectionException;

	@Override
	public abstract int addLanguages(List<Language> languages) throws JDBCTransactionException, JDBCStatementException, JDBCConnectionException;

	@Override
	public abstract boolean existsLanguage(String code) throws JDBCStatementException, JDBCConnectionException;

	@Override
	public abstract List<String> existLanguages(List<String> codes) throws JDBCStatementException, JDBCConnectionException;

	@Override
	public abstract Language getLanguage(String code) throws JDBCStatementException, JDBCConnectionException;

	@Override
	public abstract boolean deleteLanguage(String code, boolean useTransaction) throws JDBCTransactionException, JDBCStatementException, JDBCConnectionException;
}
